#!/bin/bash
if [[ $1" = "" ]]
then
	echo "Please specify a lpar host"
	exit 1
else
	LPARHOST=$1
	echo "Getting LPAR parameters for $LPARHOST..."
	CONSOLE=`sudo /home/hmcadm/scripts/find_lpar.sh $LPARHOST | head -1 | xargs`
	echo "Connecting to remote console (HMC) ($CONSOLE), escape with ~."
	sudo ssh -t -e none hscroot@`echo $CONSOLE|cut -d' ' -f1` "mkvterm -m `echo $CONSOLE|cut -d' ' -f2` -p `echo $CONSOLE|cut -d' ' -f3`"
fi
exit 0
